#! /usr/bin/python
import mathex
from math import sqrt

isPrime = mathex.isPrime

def main():
    for i in range(35,100000,2):
        if not isPrime(i):
            sable = False
            for j in range(1,i):
                if isPrime(j):
                    k = sqrt((i - j)/2)
                    if k == int(k):
                        sable = True
                        break
            if not sable:
                print i
                break

if __name__ == '__main__':
    main()
    
